//
//  xsTemplateCollectionViewHeadView.m
//  digital_robot_demo
//
//  Created by xskj on 2024/8/30.
//

#import "xsTemplateCollectionViewHeadView.h"
  
@interface xsTemplateCollectionViewHeadView()

@end


@implementation xsTemplateCollectionViewHeadView


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        [self addSubview:self.bottomView];
//        [self.bottomView addSubview:self.titleLabel];
//        [self.bottomView addSubview:self.rightArrowButton];
//        self.bottomView.frame = CGRectMake(5.0, 0, frame.size.width-10.0, frame.size.height);
//        self.titleLabel.frame = CGRectMake(5.0, 0, frame.size.width-10.0-10, frame.size.height);
//        
//        self.rightArrowButton.frame = CGRectMake(frame.size.width-10.0-10-frame.size.height, 0, frame.size.height, frame.size.height);
    }
    return self;
}

- (UIView *)bottomView {
    if (!_bottomView) {
        _bottomView = [[UIView alloc] init];
        _bottomView.backgroundColor = UIColor.clearColor;
        _bottomView.layer.cornerRadius = 6.0;
        _bottomView.layer.masksToBounds = YES;
    }
    return _bottomView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = UIColor.clearColor;
//        _titleLabel.font = FontSemibold(17);
//        _titleLabel.textColor = COLOR_Black33;
//        _titleLabel.numberOfLines = 3;
//        _titleLabel.text = kLocalizedString(@"主题");
        _titleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _titleLabel;
}

- (UIButton *)rightArrowButton{
    if (!_rightArrowButton) {
        _rightArrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _rightArrowButton.backgroundColor = UIColor.clearColor;
        [_rightArrowButton addTarget:self action:@selector(rightArrowButtonAction:) forControlEvents:UIControlEventTouchUpInside];
        [_rightArrowButton setImage:[UIImage imageNamed:@"timeAsc"] forState:UIControlStateNormal];
        [_rightArrowButton setImage:[UIImage imageNamed:@"timeDesc"] forState:UIControlStateSelected];
        _rightArrowButton.selected = NO;
        [_rightArrowButton setImageEdgeInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
    }
    return _rightArrowButton;
}
- (void)rightArrowButtonAction:(UIButton *)btn{
    NSLog(@"rightArrowButtonAction\n\n");
    btn.selected = !btn.selected;
    
}

@end
